﻿using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
using MvcTests.BestPractice.Repository.EntityFramework;

namespace MvcTests.BestPractice.Repository.ContainerInstallers
{
    public class DbContextInstaller : IWindsorInstaller
    {
        public const string BookLibraryDbContextKey = "BookLibraryDbContext";
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.Register(
                Component.For<BookLibraryDbContext>()
                .Named(BookLibraryDbContextKey)
                .LifestylePerWebRequest()
                );
        }
    }
}